/**
 * Created by CK on 2016/7/26.
 */
$(document).ready(function(){
    $('.xh-form').parseForm();
    $('#XHAsk_Survey_tStartTime, #XHAsk_Survey_tEndTime').datetimepicker({
        format: 'yyyy-mm-dd hh:ii:ss',  //年-月-日 时-分-秒
        autoclose:true,                 //自动关闭
        language:'zh-CN',               //中文
        todayBtn:true,                  //选择今天按钮
        minView:0                       //只选择到分
    });
    $('#XHAsk_Survey_tStartTime').val(xhTool.getNowDateTime());
    var topModalBtn = $(window.top.document).find('#bt_modal_confirm');
    topModalBtn.addClass('disabled');                                               //默认禁用确认按钮
    $('#XHAsk_Survey_sAskTitle, #XHAsk_Survey_tEndTime').on('keyup change', function(){          //输入标题则启用按钮
        if($('#XHAsk_Survey_sAskTitle').val() == '' || $('#XHAsk_Survey_tEndTime').val() == ''){
            topModalBtn.addClass('disabled');
        }
        else{
            topModalBtn.removeClass('disabled');
        }
    });
    topModalBtn.click(function(){
        $('#xh_form').submit();
        window.top.xhTop.closeModal();
        //$(window.top.document).find('.modal-header .close').click();
    });
});
